local _G = GLOBAL

function Countprefabs()
    local count = 0
    local count_cordon = 0
    for k, v in pairs(Ents) do
        if v.prefab == "cave_entrance_open" or v.prefab == "cave_entrance" or v.prefab == "cave_entrance_ruins" or v.prefab == "cave_exit" then
            count = count + 1
            if v.components.sw_cordon and v.components.sw_cordon.cordon == true then
                count_cordon = count_cordon + 1
            end
        end
    end
    return count, count_cordon
end

local PREFABS =
{
    "alterguardian_phase1",
    "alterguardian_phase2",
    "alterguardian_phase3",
    "lunarthrall_plant",
    "mutatedbearger",
    "mutatedwarg",
    "mutateddeerclops",

    "stalker_atrium",
    "daywalker",
    "shadowthrall_wings",
    "shadowthrall_hands",
    "shadowthrall_horns",
    "shadowthrall_mouth",
}
function Countprefabs_unbalanced()
    local is_strong_unbalanced = TheWorld.components.sw_sealsinkholemanager.is_strong_unbalanced
    for k, v in pairs(Ents) do
        if table.contains(PREFABS, v.prefab) then
            if is_strong_unbalanced then
                if v.components.health then
                    v.components.health.maxhealth = v.components.health.maxhealth * 2
                    v.components.health:SetCurrentHealth(v.components.health.currenthealth * 2)
                    v.components.health.sw_RangedDamageReduction = true
                end
            else
                if v.components.health then
                    v.components.health.maxhealth = v.components.health.maxhealth * 0.5
                    v.components.health:SetCurrentHealth(v.components.health.currenthealth * 0.5)
                    v.components.health.sw_RangedDamageReduction = false
                end
            end
        end
    end
end

_G.Countprefabs = Countprefabs
_G.Countprefabs_unbalanced = Countprefabs_unbalanced
